/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package org.beiyou;

import java.math.BigDecimal;

/**
 * <p>Project: javase202202 - Ex1
 * <p>Powered by Lisi On 2022-05-30 14:12:09
 * <p>Created by IntelliJ IDEA
 *

 * @version 1.0
 * @since 17
 */
public class Ex1 {
    public static void main(String[] args) {
        System.out.println(4.0-3.6); //0.3999999999999999
        System.out.println(100/11.0); //9.090909090909092

        System.out.println(4.35*100);
        System.out.println(Math.round(4.35*100));

        System.out.println(2.0-1.9);

        BigDecimal m = new BigDecimal("100.0");
        BigDecimal n = new BigDecimal("11");
        System.out.println(m.divide(n,18,BigDecimal.ROUND_HALF_UP).doubleValue());

        //MyMath.floor();
        System.out.println(Math.floor(1.9));//1.0
        //MyMath.ceil();
        System.out.println(Math.ceil(1.1)); //以小数就入整 2.0
        //MyMath.round();



        BigDecimal a = new BigDecimal(4.0);
        BigDecimal b = new BigDecimal(3.6);
        System.out.println(a.subtract(b));


        //"4.0"
        //String.valueOf(4.0)
        //Double.toString(4.0)
        BigDecimal a1 = new BigDecimal("4.0");
        BigDecimal b1 = new BigDecimal("3.6");
        System.out.println(a1.subtract(b1));
    }
}
